/**
 * 继承Thread线程方法
 */
public class ThreadDemo {
    public static void main(String[] args) {
        MyThread t1 = new MyThread();
        MyThread t2 = new MyThread();
        t1.setName("线程一");
        t2.setName("线程二");
        t1.start();
        t2.start();
    }

    static class MyThread extends Thread{
        @Override
        public void run() {
            String name = getName();
            for(int i = 0; i < 100; i++){
                System.out.println(name + i);
            }
        }
    }
}
